package cn.ybk.basic.controller;

import cn.ybk.basic.dto.EmailDto;
import cn.ybk.basic.dto.EmailRegisterFormDto;
import cn.ybk.basic.service.EmailCodeService;
import cn.ybk.basic.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/EmailCode")
public class EmailCodeController {

    @Autowired
    private EmailCodeService emailCodeService;


    @PostMapping("/emailCode")
    public AjaxResult emailCode(@RequestBody @Valid EmailRegisterFormDto dto){
        emailCodeService.emailCode(dto);
        return AjaxResult.me().success();
    }

    @PostMapping("/emailRegister")
    public AjaxResult emailRegister(@RequestBody @Valid  EmailDto dto){
        emailCodeService.emailRegister(dto);
        return AjaxResult.me().success();
    }


}
